package com.itheima.model.vo;

import com.itheima.model.pojo.Questions;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class QuestionsVo {

    // 试题编号
    private String id;

    // 题目
    private String question;

    // 选项
    private List<OptionsVo> options;

    public static QuestionsVo init(Questions questions) {
        QuestionsVo vo = new QuestionsVo();
        BeanUtils.copyProperties(questions, vo);
        vo.setId(questions.getId().toString());

        return vo;
    }

}
